<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>upfile</title>
</head>
<body>
  <?php
    require 'UploadFile.class.php';
    if(isset($_POST['sf']) && $_POST['sf']=='sf'){
      if ($_FILES["file"]["error"] > 0){
        echo "Error: " . $_FILES["file"]["error"] . "<br />";
      }else{
        $file = $_FILES['file'];
         
        $upload = new UploadFile(true, './images/', array('jpg', 'jpeg', 'png'));
        $upload->upload_file($file);
        echo $upload->get_msg();
      }
    }else{
  ?>
  <form action="" method='post' enctype="multipart/form-data">
    <input type="file" name="file" id="file" />
    <input type="hidden" name="sf" value="sf"/>
    <input type="submit" value="上传" name="sub" />
  </form>
  <?php
    }
  ?>
</body>
</html>